package test.monitors;

import basemod.ReflectionHacks;
import basemod.interfaces.OnStartBattleSubscriber;
import basemod.interfaces.PostUpdateSubscriber;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.Soul;
import com.megacrit.cardcrawl.cards.SoulGroup;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.rooms.AbstractRoom;

import java.util.ArrayList;

public class PostUpdateMonitor implements PostUpdateSubscriber{

    public static AbstractCard moveOutCard=null;

    public Soul soulContains(AbstractCard card){
        if(card==null){
            return null;
        }
        ArrayList<Soul> souls = ReflectionHacks.getPrivate(AbstractDungeon.currMapNode.room.souls,SoulGroup.class, "souls");
        for(Soul soul:souls){
            if(soul.card != null&&soul.card.equals(card)){
                return soul;
            }
        }
        return null;
    }

    @Override
    public void receivePostUpdate() {
        if(soulContains(moveOutCard)!=null){
            Soul soul=soulContains(moveOutCard);
            soul.isDone = true;
        }
    }
}
